﻿//--------------------------------------------------------------------------------
// This file is part of the MusicWho - MusicComposer.
//
// Copyright © 2010 Alex-Joyce. All rights reserved.
//
// For information about this application and licensing, go to http://musicwho.codeplex.com.
//
// THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
//--------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using MWCore;

namespace MusicWhoConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            Random rm = new Random();
            List<List<double>> sp = new List<List<double>>();
            int sn = 3000;
            int stn = 1;
            for (int j = 0; j < stn; j++)
            {
                List<double> t = new List<double>();
                for (int i = 0; i < sn; i++)
                {
                    t.Add(rm.NextDouble() * 10);
                }
                t.Sort();
                sp.Add(t);
            }

            SpikeComposer spikecom = new SpikeComposer(sp);
            SpikeComposeParameter scp = new SpikeComposeParameter();
            scp.LongIntegrateTime=0.1;
            scp.ShortIntegrateTime = 0.03;
            spikecom.Compose(scp);


            SpikePlayer spikeplay = new SpikePlayer(spikecom.SpikeScores);
            SpikePlayParameter spp = new SpikePlayParameter();
            spp.key = 0;


            string path = Directory.GetCurrentDirectory();
            path = path +"\\mw"+ DateTime.Now.Day+DateTime.Now.Hour+DateTime.Now.Minute+".mid";

            MIDI.Save(path, spikeplay.Play(spp));

        }
    }
}
